/*
 * Particle.cpp
 *
 *  Created on: 19/05/2010
 *      Author: jorge
 */

#include "Particle.h"

namespace physics {

Particle::Particle() {
	Vector3D cero(0,0,0);
	p = cero;
	v = cero;
	f = cero;
	m = 1.0;
}

Particle::Particle(Vector3D p, float m) : p(p), m(m){
	Vector3D cero(0,0,0);
	v = cero;
	f = cero;
}

Particle::Particle(Vector3D p, Vector3D v, float m) : p(p), v(v), m(m){
	Vector3D cero(0,0,0);
	f = cero;
}

Particle::Particle(Vector3D p, Vector3D v, Vector3D f, float m) : p(p), v(v), f(f), m(m){
}

Particle::Particle(Vector3D p) : p(p) {
	Vector3D cero(0,0,0);
	v = cero;
	f = cero;
	m = 1.0;
}

Particle::Particle(Vector3D p, Vector3D v) : p(p), v(v) {
	Vector3D cero(0,0,0);
	f = cero;
	m = 1.0;
}

Particle::Particle(Vector3D p, Vector3D v, Vector3D f) : p(p), v(v), f(f) {
	m = 1.0;
}

Particle::~Particle() {

}

void Particle::setPosition(const Vector3D& p) {
	this->p = p;
}

void Particle::setVelocity(const Vector3D& v) {
	this->v = v;
}

void Particle::setForce(const Vector3D& f) {
	this->f = f;
}

void Particle::setMass(float m) {
	this->m = m;
}

const Vector3D Particle::getPosition() const{
	return p;
}

const Vector3D Particle::getVelocity() const{
	return v;
}

const Vector3D Particle::getForce() const{
	return f;
}

float Particle::getMass() const{
	return m;
}

void Particle::addPosition(const Vector3D& p) {
	this->p += p;
}

void Particle::addVelocity(const Vector3D& v) {
	this->v += v;
}

void Particle::addForce(const Vector3D& f) {
	this->f += f;
}

void Particle::emptyForce() {
	f = Vector3D(0, 0, 0);
}

void Particle::emptyVelocity() {
	v = Vector3D(0, 0, 0);
}

void Particle::setFixed() {
	this->fix = true;
}

void Particle::setLoose() {
	this->fix = false;
}

bool Particle::fixed() {
	return fix;
}

}
